#ifndef WINDOWSGUI_H
#define WINDOWSGUI_H
#include <string>
#include <vector>

class InputDialog
{
public:
    InputDialog();
    ~InputDialog();
    bool DoModal( HWND parent= 0 );
    const char *GetInput( );
    static int WINAPI DlgProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
    static InputDialog *thisptr;

    char input[1024];
    bool isok;
};

class ComboListMode
{
public:
    virtual int GetCount( )=0;
    virtual std::string GetElemAt( int i )=0;
    virtual int GetReturn( int i ) { return i; };
};

class KeyComboListMode:public ComboListMode
{
public:
    virtual int GetCount( );
    virtual std::string GetElemAt( int i );
};

class MinigameComboListMode:public ComboListMode
{
public:
    virtual int GetCount( );
    virtual std::string GetElemAt( int i );
};

class RegionComboListMode:public ComboListMode
{
public:
    virtual int GetCount( );
    virtual std::string GetElemAt( int i );
    virtual int GetReturn( int i );
};

class TriggerComboListMode:public ComboListMode
{
public:
    virtual int GetCount( );
    virtual std::string GetElemAt( int i );
};

class ConditionComboListMode:public ComboListMode
{
public:
    virtual int GetCount( );
    virtual std::string GetElemAt( int i );
};

class ActionComboListMode:public ComboListMode
{
public:
    virtual int GetCount( );
    virtual std::string GetElemAt( int i );
};
class ComboDialog
{
public:
    ComboDialog( ComboListMode *l );
    ~ComboDialog();
    bool DoModal( HWND parent= 0 );
    static int WINAPI DlgProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
    static ComboDialog *thisptr;

    ComboListMode *listmode;
    int select;
    int value;
    std::string selectstr;
    bool isok;
};

#define TRIG_NUM 4

struct ParamDef
{
    std::string name;
    std::string inputtype;
    std::string inputparam; 
};

typedef std::vector<ParamDef> ParamDefVec;
struct TriggerDef
{
    std::string name;
    ParamDefVec paramdef;
};

struct ConditionDef
{
    std::string name;
    ParamDefVec paramdef;
};

struct ActionDef
{
    std::string name;
    ParamDefVec paramdef;
};

typedef std::vector<TriggerDef> TriggerDefVec;
typedef std::vector<ConditionDef> ConditionDefVec;
typedef std::vector<ActionDef> ActionDefVec;

struct TriggerConfig
{
    TriggerDefVec triggers;
    ConditionDefVec conditions;
    ActionDefVec actions;
    void ReadConfig();
};

class TriggerDialog
{
public:
    TriggerDialog();
    ~TriggerDialog();
    bool DoModal( );
    static int WINAPI DlgProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
    ComboListMode *CreateListMode( const char *name );
    static TriggerConfig conf;
    static TriggerDialog *thisptr;

    int trigger[TRIG_NUM];
    int condition[TRIG_NUM];
    int action[TRIG_NUM];
    std::string regionname;

    int triggerindex;
    int conditionindex;
    int actionindex;
    bool isok;
};
#endif